// V-webapp/src/router/index.ts
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ActivitiesView from '../views/ActivitiesView.vue'
import ActivityDetailView from '../views/ActivityDetailView.vue'
import ProductsView from '../views/ProductsView.vue'
import CartView from '../views/CartView.vue'
import ProfileView from '../views/ProfileView.vue'
import LoginView from '../views/LoginView.vue'
import MobileTipView from '../views/MobileTipView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/activities',
      name: 'Activities',
      component: ActivitiesView,
    },
    {
      path: '/activity/:id',
      name: 'ActivityDetail',
      component: ActivityDetailView,
      props: true
    },
    {
      path: '/products',
      name: 'Products',
      component: ProductsView,
    },
    {
      path: '/cart',
      name: 'Cart',
      component: CartView,
    },
    {
      path: '/profile',
      name: 'Profile',
      component: ProfileView,
    },
    {
      path: '/login',
      name: 'Login',
      component: LoginView,
    },
    {
      path: '/mobile-tip',
      name: 'MobileTip',
      component: MobileTipView
    },
    // 新增路由 - 保持与您原有格式一致
    {
      path: '/product/:id',
      name: 'ProductDetail',
      component: () => import('../views/ProductDetailView.vue'),
      props: true
    },
    {
      path: '/my-registrations',
      name: 'MyRegistrations',
      component: () => import('../views/MyRegistrationsView.vue')
    },
    {
      path: '/my-orders',
      name: 'MyOrders',
      component: () => import('../views/MyOrdersView.vue')
    },
    {
      path: '/checkout',
      name: 'Checkout',
      component: () => import('../views/CheckoutView.vue')
    },
    {
      path: '/settings',
      name: 'Settings',
      component: () => import('../views/SettingsView.vue')
    },
    // 新增支付相关路由
    {
      path: '/payment',
      name: 'Payment',
      component: () => import('../views/PaymentView.vue')
    },
    {
      path: '/payment/success',
      name: 'PaymentSuccess',
      component: () => import('../views/PaymentSuccessView.vue')
    },
    {
      path: '/:pathMatch(.*)*',
      name: 'NotFound',
      component: () => import('../views/NotFoundView.vue')
    }
  ],
})

export default router